//
//  PersonIndexer.m
//  namefight
//
//  Created by nasa on 11-4-1.
//  Copyright 2011年 nasawz.com. All rights reserved.
//

#import "PersonIndexer.h"


@implementation PersonIndexer
@synthesize p1,p2;

static PersonIndexer * shareInstance = nil;

+(PersonIndexer *) shareInstance {
    if (!shareInstance) {
        shareInstance = [[self alloc] init];
    }
    return  shareInstance;
}
+ (NSDictionary *)createPersonProperty:(NSString *)name {
    NSArray * protyArr = [[name MD5Arr] retain];
    
    double per = (([[protyArr objectAtIndex:15] intValue] > 100)?(1):([[protyArr objectAtIndex:15] intValue])*0.01);    
    //NSLog(@"per = %f",per);
    
    //NSLog(@"dex ==== %@",[NSNumber numberWithInt:(37 + (int)[[protyArr objectAtIndex:0] intValue]*per)]);
    NSNumber * dex = [NSNumber numberWithInt:(37 + (int)[[protyArr objectAtIndex:0] intValue]*per)];
    //NSLog(@"灵巧:%@",dex);
    NSNumber * agi = [NSNumber numberWithInt:(37 + (int)[[protyArr objectAtIndex:1] intValue]*per)];
    //NSLog(@"敏捷:%@",agi);
    
    NSNumber * vit = [NSNumber numberWithInt:(100 + (int)[[protyArr objectAtIndex:2] intValue]*per*0.1)];
    //NSLog(@"体质:%@",vit);
    NSNumber * mana = [NSNumber numberWithInt:(37 + (int)[[protyArr objectAtIndex:3] intValue]*per)];
    //NSLog(@"斗气:%@",mana);    
    
    NSNumber * act = [NSNumber numberWithInt:(37 + (int)[[protyArr objectAtIndex:4] intValue]*per)];
    //NSLog(@"攻击:%@",act);
    NSNumber * luck = [NSNumber numberWithInt:(37 + (int)[[protyArr objectAtIndex:5] intValue]*per)];
    //NSLog(@"运气:%@",luck);   
    
    if ([name isEqualToString:@"中国"] || [name isEqualToString:@"china"]) {
        vit = [NSNumber numberWithInt:999]; act = [NSNumber numberWithInt:50];
    }
    
    [protyArr release];
    return [NSDictionary dictionaryWithObjectsAndKeys:
            dex,@"dex",
            agi,@"agi",
            vit,@"vit",
            mana,@"mana",
            act,@"act",
            luck,@"luck",nil];    
}
@end
